#ifndef DATABUFFER_H
#define DATABUFFER_H

#include <vector>
#include <queue>
#include <map>

//this class is not threads safe!!!!
class DataBuffer
{
public:
    DataBuffer(int size = 50);
    ~DataBuffer();
    void cacheData(unsigned int ts, int seq, unsigned char * data, int len);
    int getCount(unsigned int ts);
    bool has(unsigned int ts, int seq);
    int getData(unsigned int ts, int seq, unsigned char * data, int offset);
private:
    std::map<unsigned int, std::map< int, std::vector<unsigned char> > > m_data;
    std::queue<unsigned int> m_ts_queue;
    int m_max_size;
};

#endif // DATABUFFER_H
